import { createContext, useContext } from 'react';
import stores from '../models';

const StoresContext = createContext(stores);

const useStores = () => useContext(StoresContext);

function useDeviceDataStore() {
  const { deviceData } = useStores();
  return deviceData;
}

function useInfraRedConfigStore() {
  const { infraRedConfig } = useStores();
  return infraRedConfig;
}

function useDeviceDetailStore() {
  const { deviceDetail } = useStores()
  return deviceDetail;
}

function useHomeStore() {
  const { homes } = useStores();
  return homes;
}

function useMessagesStore() {
  const { messages } = useStores();
  return messages;
}


function useLanguageStore() {
  const { language } = useStores()
  return language;
}

function useDeviceListStore() {
  const { deviceList } = useStores()
  return deviceList;
}

function useUseStateStore() {
  const { userState } = useStores()
  return userState;
}

function useAlarmPushStore() {
  const { alarmPush } = useStores()
  return alarmPush;
}

export function useDeviceShare() {
  const { deviceShare } = useStores();
  return deviceShare;
}

function useWalletStore() {
  const { wallet } = useStores()
  return wallet;
}

export {
  StoresContext,
  useStores,
  useDeviceDataStore,
  useHomeStore,
  useLanguageStore,
  useDeviceDetailStore,
  useDeviceListStore,
  useUseStateStore,
  useMessagesStore,
  useAlarmPushStore,
  useWalletStore,
  useInfraRedConfigStore
};
